<#include "/common/dialogbox.html">
<@header>
</@header>
<@body>
  <div class="x_content">
	<form class="form-horizontal form-label-left" method="post" action="${ctx}/system/role/doAdd" id="roleAddForm">
	    <div class="form-group">
	      	<label class="control-label col-md-2 col-sm-2 col-xs-12">
	      		角色名称 <span class="required">*</span>
      		</label>
	       	<div class="col-md-9 col-sm-9 col-xs-12">
	     		<input type="text" id="roleName" name="roleName" class="form-control" placeholder="请输入角色名" required>
	   	 	</div>
	    </div>
	    <div class="form-group">
	        <label class="control-label col-md-2 col-sm-2 col-xs-12">
	        	角色描述 <span class="required">*</span>
        	</label>
	        <div class="col-md-9 col-sm-9 col-xs-12">
	         	<textarea class="form-control" name="roleDesc" rows="3" placeholder="请输入描述，最多300个字符 ..." required></textarea>
	        </div>
	    </div>
	    <div class="form-group">
	    	<label class="control-label col-md-2 col-sm-2 col-xs-12">
	    		角色状态 <span class="required">*</span>
    		</label>
	    	<div class="col-md-9 col-sm-9 col-xs-12">
		       	<label class="radio-box">
		           	<input name="roleState" type="radio" class="flat" value="1" required> 启用
				</label>
		       	<label class="radio-box">
		           	<input name="roleState" type="radio" class="flat"  value="-1" required> 禁用
				</label>
	       </div>
	    </div>
	</form>
</div>
</@body>
<@footer>
<script type="text/javascript">
	function submitHandler() {
		if ($("#roleAddForm").validate().form()) {
			var formData = $("#roleAddForm").serialize();
			$.ajax({
				url : $("#roleAddForm").attr('action'),
				type : 'POST',
				dataType: "json",
				data : formData,
				success : function(data) {
					if (data.code == 200) {
						if (data.msg) {
							parent.layer.msg(data.msg, {
								icon : 1
							});
						} else {
							parent.layer.msg('提交成功', {
								icon : 1
							});
						}
						window.parent.refreshTable();
						parent.layer.closeAll('iframe');
					} else {
						layer.msg(data.msg, { icon : 2 });
					}
				}
			});
		}
	}
</script>
</@footer>
